//
//  FindDesignTableViewCell.m
//  WZYInteriorDesign
//
//  Created by lanou on 15/12/19.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "FindDesignTableViewCell.h"
#import "UIImageView+AFNetworking.h"
@implementation FindDesignTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self.backgroundColor = [UIColor redColor];
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.personImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 80, 80)];
        self.personImage.backgroundColor = [UIColor yellowColor];
        [self setImageLayer:self.personImage];
        [self.contentView addSubview:self.personImage];
        
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 15, 100, 20)];
        self.nameLabel.font = [UIFont boldSystemFontOfSize:16.0];
        self.nameLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.nameLabel];
        
        self.addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 50, 120, 20)];
        self.addressLabel.font = [UIFont systemFontOfSize:15.0];
        self.addressLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:self.addressLabel];
        
        self.showImage0 = [[UIImageView alloc]initWithFrame:CGRectMake(10, 100, 80, 80)];
        self.showImage0.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:self.showImage0];
        
        self.showImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 80, 80)];
        self.showImage1.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:self.showImage1];
        
        self.showImage2 = [[UIImageView alloc]initWithFrame:CGRectMake(190, 100, 80, 80)];
        self.showImage2.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:self.showImage2];
        
        self.showImage3 = [[UIImageView alloc]initWithFrame:CGRectMake(280, 100,80,80)];
        self.showImage3.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:self.showImage3];
        
        
        self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(200, 15, 110, 30)];
        self.priceLabel.font = [UIFont systemFontOfSize:15.0];
        self.priceLabel.textColor = [UIColor orangeColor];
        //[self.contentView addSubview:self.priceLabel];
    }
    return self;
}

//重写model set方法
- (void)setFindDesign:(FindDesign *)findDesign{
    if (_findDesign != findDesign) {
        _findDesign = findDesign;
        [self.personImage setImageWithURL:[NSURL URLWithString:findDesign.user_face]];
        self.nameLabel.text = findDesign.user_nick;
        self.addressLabel.text = findDesign.location;
        [self.showImage0 setImageWithURL:[NSURL URLWithString:findDesign.pro_covers[0]]];
        [self.showImage1 setImageWithURL:[NSURL URLWithString:findDesign.pro_covers[1]]];
        [self.showImage2 setImageWithURL:[NSURL URLWithString:findDesign.pro_covers[2]]];
        [self.showImage3 setImageWithURL:[NSURL URLWithString:findDesign.pro_covers[3]]];
        self.priceLabel.text = findDesign.pro_price_min;
    }
}
//将人物图片设置为圆形
- (void)setImageLayer:(UIImageView *)imageView{
    imageView.layer.cornerRadius = imageView.bounds.size.height/2;
    imageView.layer.masksToBounds = YES;
    imageView.layer.borderWidth = 2;
    imageView.layer.borderColor = [[UIColor orangeColor]CGColor];
    
}










- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
